
var asInitVals = new Array();

$(document).ready(function() {
    var oTable = $('#mtxtable').dataTable({
        "oLanguage": {
            "sSearch": "Search all columns:"
        }, "bPaginate": true,
        "sPaginationType": "bootstrap",
        "bInfo": true,
        "fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull, oSettings) {
            var numStart = this.fnPagingInfo().iStart;
            var index = numStart + iDisplayIndexFull + 1;
            $('td:eq(0)', nRow).html(index);
            return nRow;
        },
        "aoColumns": [
            {"bSortable": false, sClass: "center"},
            {"bSortable": false},
            {"bSortable": true, sDefaultContent: "-", sClass: "right"},
            {"bSortable": true, sClass: "right"},
            {"bSortable": true, sClass: "right"},
            {"bSortable": true, sClass: "right"},
            {"bSortable": true, sClass: "right"},
            {"bSortable": true, sClass: "right"},
            {"bSortable": true, sClass: "right"},
            {"bSortable": true, sClass: "right"},
            {"bSortable": true, sClass: "right"},
            {"bSortable": true, sClass: "right"},
            {"bSortable": true, sClass: "right"},
            {"bSortable": true, sClass: "right"},
            {"bSortable": true, sClass: "right"} 
        ]
    });
    $("thead input").keyup(function() {
        oTable.fnFilter(this.value, $("thead input").index(this));
    });


    $("thead input").each(function(i) {
        asInitVals[i] = this.value;
    });

    $("thead input").focus(function() {
        if (this.className == "search_init")
        {
            this.className = "";
            this.value = "";
        }
    });

    $("thead input").blur(function(i) {
        if (this.value == "")
        {
            this.className = "search_init";
            this.value = asInitVals[$("thead input").index(this)];
        }
    });

});